<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.28.
   家居积分日志控制器($$)*/

!defined('Q_PATH') && exit;

class JiajucreditlogController extends AController{

	public function filter_(&$arrMap){
		$arrMap['A.jiajucreditlog_module']=array('like',"%".Q::G('jiajucreditlog_module')."%");
		$arrMap['A.jiajucreditlog_tips']=array('like',"%".Q::G('jiajucreditlog_tips')."%");
		$arrMap['A.jiajucreditlog_grade']=array('egt',intval(Q::G('jiajucreditlog_grade')));
		
		// 添加时间
		$this->getTime_('A.jiajucreditlog_itemtime',$arrMap);
	}

	public function index($sModel=null,$bDisplay=true){
		parent::index('jiajucreditlog',false);
		$this->display(Admin_Extend::template('jiaju','jiajucreditlog/index'));
	}

	protected function sqljoin_(){
		return "->join('".Q::C('DB_PREFIX')."jiajucompany AS C','C.jiajucompany_id,C.jiajucompany_fullname,C.jiajucompany_isfvip,C.jiajucompany_domain','A.jiajucompany_id=C.jiajucompany_id')";
	}

	public function forbid($sModel=null,$sId=null,$bApp=false){
		$nId=intval(Q::G('value','G'));
		parent::forbid('jiajucreditlog',$nId,true);
	}

	public function resume($sModel=null,$sId=null,$bApp=false){
		$nId=intval(Q::G('value','G'));
		parent::resume('jiajucreditlog',$nId,true);
	}

	public function foreverdelete_deep($sModel=null,$sId=null){
		$sId=Q::G('value');
		parent::foreverdelete_deep('jiajucreditlog',$sId);
	}

	public function getType($nType){
		switch($nType){
			case 1:return '<span style="color:green;">增加积分</span>';
			case 0:return '<span style="color:red;">减少积分</span>';
			case 2:return '<span style="color:gray;">积分上限</span>';
			case 3:return '<span style="color:gray;">月次数上限</span>';
		}
	}

}
